<html>
<head>
    <script src="bogus/1/OpenLayers.js-foo"></script>
    <script src="bogus/2/foo-OpenLayers.js"></script>
    <script id="script" src="../lib/OpenLayers.js"></script>
    <script type="text/javascript">
        function test_OpenLayers(t) {
            t.plan(3);

            var script = document.getElementById("script");

            t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected.");
            
            // create a clone of OpenLayers._getScriptLocation
            eval("var getScriptLocation = " + OpenLayers._getScriptLocation.toString());
            var scriptLocation;
            
            script.setAttribute("src", "../lib/OpenLayers.js?foo");
            t.eq(getScriptLocation(), "../", "Script location with search string correctly detected.");
            scriptLocation = null;

            // now pretend we're using a built script
            OpenLayers._scriptName = "OpenLayers.js";
            t.eq(getScriptLocation(), "../lib/", "not fooled by bogus paths");
            
        }
    </script>
</head>
<body>
</body>
</html>
